#ifndef LANGUAGE_XML_SERIALIZER_H
#define LANGUAGE_XML_SERIALIZER_H

#include <QVector>
#include "LanguageElement.h"

QT_BEGIN_NAMESPACE
class QXmlStreamReader;
QT_END_NAMESPACE

class LanguageModel;

class LanguageXmlSerializer
{
public:
    
    LanguageXmlSerializer();
    ~LanguageXmlSerializer();
    
    bool loadFile( const QString & filename, LanguageModel * model );
    bool saveFile( const QString & filename, const LanguageModel * model );
    
    const QVector<LanguageElement> & getLanguageElementTable() const
    {
        return LanguageTable;
    }
    
private:

    LanguageXmlSerializer( const LanguageXmlSerializer & );
    LanguageXmlSerializer & operator=( const LanguageXmlSerializer & );
    
    void handleLanguage();
	void handleLanguageElement();
    
    QString readLeafNode();
    
    QXmlStreamReader
        * streamReader;
    QXmlStreamWriter
        * streamWriter;
    QVector<LanguageElement>
        LanguageTable;

};

#endif